<template>
  <el-dialog
    title="消费扣款"
    width="35%"
    :visible="dialogDeduction"
    :before-close="handleClose"
    :lock-scroll="false"
    :append-to-body="true"
  >
    <el-form
      size="small"
      :rules="rules"
      ref="form"
      :model="form"
      label-position="top"
      style="margin: 0px 20px"
    >
      <el-form-item
        prop="stationId"
        v-if="hiding !== 1 && hiding !== 2"
        label="油站选择"
        :label-width="formLabelWidth"
        class="item-radio-button"
      >
        <el-radio-group v-model="form.stationId" @input="changeStation">
          <el-radio-button
            v-for="item in stationIdList"
            :key="item.stationId"
            :label="item.stationId"
            class="radio-button"
          >
            <div class="radio-button-span">
              {{ item.stationName }}
            </div>
          </el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item
        prop="userId"
        v-if="hiding !== 2"
        label="员工选择"
        :label-width="formLabelWidth"
        class="item-radio-button"
      >
        <el-radio-group v-model="form.userId" @input="changeUser">
          <el-radio-button
            v-for="item in nickNameList"
            :key="item.userId"
            :label="item.userId"
            class="radio-button"
          >
            <div class="radio-button-span">
              {{ item.nickName }}
            </div></el-radio-button
          >
        </el-radio-group>
      </el-form-item>
      <el-form-item
        prop="gunName"
        label="选择油枪"
        :label-width="formLabelWidth"
        class="item-radio-button"
      >
        <el-radio-group v-model="form.gunName" @input="changeGunName">
          <el-radio-button
            v-for="item in gunList"
            :key="item.gunName"
            :label="item.gunName"
            class="radio-button"
          >
            <div class="radio-button-span">
              {{ item.gunName }}
            </div>
          </el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="订单金额（元）" prop="receivableAmt">
        <el-input
          size="mini"
          placeholder="请输入订单金额"
          maxlength="11"
          v-model="form.receivableAmt"
          @input="inputReceivableAmt"
        ></el-input>
      </el-form-item>
      <el-form-item label="支付方式" prop="payType">
        <el-radio-group
          v-model="form.payType"
          style="display: flex; flex-direction: row"
          @input="inputPayType"
        >
          <el-radio
            style="width: 12rem"
            v-for="item in payTypeList"
            :key="item.storedCardType"
            :label="item.storedCardType"
            >{{ item.storedCardName }} (余额: {{ item.amt }}元)
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="参与立减活动" class="form-enableDiscount">
        <el-switch
          v-model="form.enableDiscount"
          @change="enableDiscount"
        ></el-switch>
      </el-form-item>
      <el-form-item label="使用优惠券" class="form-enableDiscount">
        <el-switch
          v-model="form.enableCoupon"
          @change="enableCoupon"
        ></el-switch>
      </el-form-item>
      <el-form-item v-show="form.enableCoupon">
        <el-select
          v-model="couponUserIdList"
          placeholder="请选择优惠券"
          style="width: 100%"
          size="mini"
          multiple
          @change="changeCouponUserId"
          @visible-change="handleCoupon"
        >
          <el-option
            v-for="item in couponList"
            :label="item.issueName"
            :value="item.couponUserId"
          >
            <span style="float: left">{{ `${item.issueName}${item.isMergeUse == 1? '-可叠加': ''}` }}</span>
            <span style="float: right; color: #8492a6; font-size: 13px">{{
              item.couponUserId
            }}</span></el-option
          >
        </el-select>
      </el-form-item>
      <el-form-item v-if="isFree" label="支付密码" prop="password">
        <el-input
          size="mini"
          placeholder="请输入密码"
          v-model="form.password"
          type="password"
        ></el-input>
      </el-form-item>
    </el-form>
    <div>
      <hr style="border: 1px dashed #d5d6d8; margin-top: 20px" />
      <div class="dialog-foot">
        <div
          style="
            font-size: 17px;
            font-weight: 600;
            margin-left: 20px;
            margin-bottom: 10px;
          "
        >
          <span>实付金额：</span>
          <span>{{ amt }}</span>
          <span> 元 </span>
          <span style="font-size: 16px; font-weight: 400; color: red"
            >（共优惠：{{ totalDiscountAmt }}元）</span
          >
        </div>
        <div class="dialog-foot-button">
          <button class="foot-button-left" @click="resetForm('form')">
            取 消
          </button>
          <button
            class="foot-button-right"
            type="primary"
            @click="submitForm('form')"
          >
            确 定
          </button>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import lodash from "lodash";
import { listEnterpriseStation } from "@/api/dept";
import {
  listWithOil,
  cardList,
  create,
  update,
  pay,
} from "@/api/customer/info";
import { cloneDeep } from "lodash";
import { employeeSign } from "@/api/dept";
export default {
  name: "CouponDeduction",
  props: {
    dialogDeduction: {
      type: Boolean,
      default: false,
    },
    couponsInfo: {
      default: () => [],
    },
  },

  data() {
    var receivableAmt = (rule, value, callback) => {
      let amount = Number(String(value).trim());
      const reg = /^\d+(\.\d{1,2})?$/;
      if (value.charAt(value.length - 1) == ".")
        return callback(new Error("请输入有效数值"));
      if (!value) return callback(new Error("请输入金额"));
      if (String(value).startsWith("."))
        return callback(new Error("请输入有效数值"));
      if (Number.isNaN(amount)) return callback(new Error("请输入合法数字"));
      if (!reg.test(amount)) return callback(new Error("金额最多保留两位小数"));
      callback();
    };
    return {
      curCoupon: {} ,// 用于优惠券默认下拉选中值
      curList: [], //用于优惠券下拉框 判断
      couponUserIdList: [], //用于判断多张优惠券
      // id
      couponUserId: null,
      // 实付金额
      amt: null,
      // 共优惠金额
      totalDiscountAmt: null,
      // 订单号
      orderNo: null,
      // 优惠券NO
      couponNo: null,
      // 优惠券列表
      couponList: [],
      // 会员id
      consumerId: null,
      // 是否开启免密
      isFree: null,
      // 支付方式列表
      payTypeList: [],
      // 隐藏元素
      hiding: 0,
      // 油站数组
      stationIdList: [],
      // 员工列表
      nickNameList: [],
      // 油枪列表
      gunList: [],

      form: {
        // 油站选择值
        stationId: null,
        // 员工选择值
        userId: null,
        // 油枪选择值
        gunName: null,
        // 订单金额（元）
        receivableAmt: null,
        // 支付方式
        payType: null,
        // 参与立减活动
        enableDiscount: true,
        // 使用优惠券
        enableCoupon: true,
        // 密码
        password: null,
        // 优惠券id
        couponUserId: null,
      },
      formLabelWidth: "120px",

      rules: {
        stationId: [
          { required: true, message: "请选择油站", trigger: "change" },
        ],
        userId: [{ required: true, message: "请选择员工", trigger: "change" }],
        gunName: [{ required: true, message: "请选择油枪", trigger: "change" }],
        receivableAmt: [
          { required: true, message: "请输入金额", trigger: "blur" },
          { validator: receivableAmt, trigger: "blur" },
        ],
        payType: [
          { required: true, message: "请选择支付方式", trigger: "blur" },
        ],
        password: [
          { required: true, message: "请输入密码", trigger: "blur" },
          {
            min: 6,
            max: 6,
            message: "密码为6位数",
            trigger: "change",
          },
        ],
      },
    };
  },

  methods: {
    // 账号判断
    getUserLevel() {
      let userLevel = this.$store.state.user.userLevel;
      if (["2"].includes(userLevel)) {
        employeeSign().then((res) => {
          if (res.msg === "0") {
            this.hiding = 1;
            // 获取员工
            this.form.stationId = this.$store.state.user.stationId;
            this.listWithOil(this.$store.state.user.stationId);
          } else if (res.msg === "1") {
            this.hiding = 2;
            this.form.stationId = this.$store.state.user.stationId;
            listWithOil({
              stationId: this.$store.state.user.stationId,
            }).then((res) => {
              if (res && res.code === 200) {
                this.nickNameList = res.data;
                this.form.userId = this.$store.state.user.userId;
                this.changeUser();
              } else {
                this.$message.error(res.msg);
              }
            });
          }
        });
      } else {
        // if (["1"].includes(userLevel))
        this.listEnterpriseStation();
      }
    },

    //获取油站，this.presentEnterprise.enterpriseId
    // status 油站的状态 : 1 正常, 0 停用
    listEnterpriseStation() {
      listEnterpriseStation({
        enterpriseId:
          this.presentEnterprise && this.presentEnterprise.enterpriseId,
        status: "1",
      }).then((res) => {
        this.stationIdList = res;
        this.form.stationId = this.stationIdList[0].stationId;
        // 获取员工
        this.listWithOil(this.form.stationId);
        // 判断单站，多站
        if (res.length > 1) {
          // console.log("判断多站res.length > 1", res);
        } else if (res.length === 1) {
          // console.log("判断单站res.length === 1", res);
        }
      });
    },
    // 选择了油站
    changeStation() {
      // 清除数据
      // 员工列表
      this.nickNameList = [];
      // 油枪列表
      this.gunList = [];
      // 员工选择值
      this.form.userId = "";
      // 油枪选择值
      this.form.gunName = "";
      // 订单金额（元）
      this.form.receivableAmt = null;
      // 支付方式
      this.form.payType = null;
      // 实付金额
      this.amt = null;
      // 共优惠金额
      this.totalDiscountAmt = null;
      // 优惠券列表
      this.couponList = [];
      // 优惠券列表id
      this.form.couponUserId = null;

      // 获取员工
      this.listWithOil(this.form.stationId);
    },

    // 获取员工
    listWithOil(stationId) {
      listWithOil({
        stationId,
      }).then((res) => {
        if (res && res.code === 200) {
          this.nickNameList = res.data;
          this.form.userId = this.nickNameList[0]?.userId;
          cloneDeep(this.nickNameList).forEach((item) => {
            if (item.userId === this.form.userId) {
              this.gunList = item.gunList;
              this.form.gunName = this.gunList[0].gunName;
            }
          });
          this.cardList();
        } else {
          this.$message.error(res.msg);
        }
      });
    },

    // 选择了员工
    changeUser() {
      // 油枪列表
      this.gunList = [];
      // 油枪选择值
      this.form.gunName = "";
      // 订单金额（元）
      this.form.receivableAmt = null;
      // 实付金额
      this.amt = null;
      // 共优惠金额
      this.totalDiscountAmt = null;
      // 支付方式
      this.form.payType = null;
      // 优惠券列表
      this.couponList = [];
      // 优惠券列表id
      this.form.couponUserId = null;

      cloneDeep(this.nickNameList).forEach((item) => {
        if (item.userId === this.form.userId) {
          this.gunList = item.gunList;
          this.form.gunName = this.gunList[0].gunName;
        }
      });
      this.cardList();
    },

    // 选择了油枪
    changeGunName() {
      // 订单金额（元）
      this.form.receivableAmt = null;
      // 支付方式
      this.form.payType = null;
      // 实付金额
      this.amt = null;
      // 共优惠金额
      this.totalDiscountAmt = null;
      // 优惠券列表
      this.couponList = [];
      // 优惠券列表id
      this.form.couponUserId = null;

      this.cardList();
    },

    // 输入金额
    inputReceivableAmt: lodash.debounce(function () {
      this.$refs.form.validateField("receivableAmt", (res) => {
        if (!res) {
          this.Judgment();
          console.log("正确金额", this.form.receivableAmt);
        } else {
          if (!this.form.receivableAmt) {
            // 实付金额
            this.amt = null;
            // 共优惠金额
            this.totalDiscountAmt = null;
            // 优惠券列表
            this.couponList = [];
            // 优惠券列表id
            this.form.couponUserId = null;
          }
        }
      });
    }, 800),

    // 参与立减活动
    enableDiscount() {
      this.Judgment();
    },

    // 使用优惠券
    enableCoupon() {
      this.couponUserIdList = [this.curCoupon.couponUserId]
      this.form.couponNo = this.curCoupon.couponNo
      this.couponNo  = this.curCoupon.couponNo,
       this.form.couponUserId = this.curCoupon.couponUserId,
      this.Judgment();
    },

    // 判断如果是不可叠加的优惠券直接弹出
    // 选择了优惠券
    changeCouponUserId(e) {
      if (JSON.stringify(e) != JSON.stringify(this.curList)) {
        if (this.couponUserIdList && this.couponUserIdList.length > 0) {
          for (let i = 0; i < this.couponUserIdList.length; i++) {
            const ele = this.couponUserIdList[i];
            const isCheckout = this.couponList.find(
              (item) => ele == item.couponUserId && item.isMergeUse === 0
            );
            console.log(isCheckout, "单张优惠券的值");
            if (isCheckout !== undefined) {
              this.couponUserIdList = [isCheckout.couponUserId];
              this.curList = [isCheckout.couponUserId];
              if(isCheckout.couponUserId != e[e.length -1]) {
              this.couponUserIdList = [e[e.length -1]];
              this.curList = this.couponList.find(ele => ele.couponUserId == e[e.length -1] );
            }
            }
          }
        }
      }

      // 拼接优惠券couponUserId，couponNo
      let couponUserIdList = cloneDeep(this.couponUserIdList)
      this.form.couponUserId =  Array.from(new Set(couponUserIdList)).join(',')
      if(couponUserIdList.length){
        let arr = couponUserIdList.map(ele => {
            return this.couponList.find(item => item.couponUserId == ele);
          }).filter(ele => ele != undefined)
          this.form.couponNo = arr.map(ele => ele.couponNo).join(",")
      }
      // console.log(e, this.couponList);
      // cloneDeep(this.couponList).forEach((item) => {
      //   if (this.form.couponUserId === item.couponUserId) {
      //     this.couponNo = item.couponNo;
      //   }
      // });

    },
    closeCouponMethod() {
        this.form.enableCoupon = false
        this.couponUserIdList = []
        this.couponNo = null;
        this.couponUserId = null;
        this.form.couponUserId = null;
        this.couponList = [];
        this.form.couponUserId = null;
        this.form.couponNo = null;
    },
    handleCoupon() {
      // 需要等change事件优先触发
      if(this.couponUserIdList && this.couponUserIdList.length == 0) {
        this.closeCouponMethod()
      }
       this.Judgment()
    },

    // 选择了支付方式
    inputPayType() {
      this.Judgment();
    },

    // cardList储值卡列表
    cardList() {
      if (!(this.form.stationId && this.form.userId && this.form.gunName))
        return;
      const data = {
        consumerId: this.consumerId,
        enterpriseId:
          this.presentEnterprise && this.presentEnterprise.enterpriseId,
        stationId: this.form.stationId
          ? this.form.stationId
          : this.$store.state.user.stationId,
        gunName: this.form.gunName,
      };
      cardList(data).then((res) => {
        if (res.code === 200) {
          this.payTypeList = res.data;
        } else {
          this.$message.error(res.msg);
        }
      });
    },

    // POST/appUser/order/create创建订单
    async create() {
      const data = {
        appType: "1", //固定写死1
        orderOriginType: "4", //固定写死4
        utmSource: 9, //固定写死9
        ...this.form,
        consumerId: this.consumerId,
        enterpriseId:
          this.presentEnterprise && this.presentEnterprise.enterpriseId,
        stationId: this.form.stationId
          ? this.form.stationId
          : this.$store.state.user.stationId,
        oilPersonnel: this.form.userId,
        userId: null,
      };
      const res = await create(data);
      if (res.code == 200) {
        this.curCoupon = res.data
        this.amt = res.data.amt;
        this.totalDiscountAmt = res.data.totalDiscountAmt;
        this.orderNo = res.data.orderNo;
        this.couponNo = res.data.couponNo;
        this.couponUserId = res.data.couponUserId;
        this.form.couponUserId = res.data.couponUserId;
        this.couponUserIdList = [res.data.couponUserId]
        this.couponList = res.data.couponList;
      } else {
        this.amt = null;
        this.totalDiscountAmt = null;
        this.orderNo = null;
        this.couponNo = null;
        this.couponUserId = null;
        this.form.couponUserId = null;
        this.couponList = [];
        this.$message.error(res.msg);
      }
      // create(data).then((res) => {
      //   if (res.code === 200) {
      //     this.amt = res.data.amt;
      //     this.totalDiscountAmt = res.data.totalDiscountAmt;
      //     this.orderNo = res.data.orderNo;
      //     this.couponNo = res.data.couponNo;
      //     this.couponUserId = res.data.couponUserId;
      //     this.form.couponUserId = res.data.couponUserId;
      //     this.couponList = res.data.couponList;
      //   } else {
      //     this.amt=null
      //     this.totalDiscountAmt=null
      //     this.orderNo = null;
      //     this.couponNo =null;
      //     this.couponUserId =null;
      //     this.form.couponUserId = null;
      //     this.couponList = [];
      //     this.$message.error(res.msg);
      //   }
      // });
    },

    // POST/appUser/order/update更新订单
    async update() {
      const data = {
        appType: "1", //固定写死1
        orderOriginType: "4", //固定写死4
        utmSource: 9, //固定写死9
        consumerId: this.consumerId, //会员id
        orderNo: this.orderNo, //订单号，创建订单接口返回
        couponNo: this.couponNo, //优惠卷no，创建订单接口返回
        couponUserId: this.form.couponUserId, //优惠卷id，创建订单接口返回
        ...this.form,
        enterpriseId:
          this.presentEnterprise && this.presentEnterprise.enterpriseId,
        stationId: this.form.stationId
          ? this.form.stationId
          : this.$store.state.user.stationId, //油站id
        oilPersonnel: this.form.userId, //加油员id
        userId: null,
      };
      try {
        const res = await update(data);
        if (res.code == 200) {
          this.amt = res.data.amt;
          this.totalDiscountAmt = res.data.totalDiscountAmt;
          this.orderNo = res.data.orderNo;
          this.couponNo = res.data.couponNo;
          this.couponUserId = res.data.couponUserId;
          this.couponList = res.data.couponList;
        } else {
          this.amt = null;
          this.totalDiscountAmt = null;
          this.orderNo = null;
          this.couponNo = null;
          this.couponUserId = null;
          this.form.couponUserId = null;
          this.couponList = [];
          this.form.couponUserId = null;
          this.Judgment();
          this.$message.error(res.msg);
        }
      } catch (error) {
       this.closeCouponMethod()
        this.update()
      }


      // update(data)
      //   .then((res) => {
      //     if (res.code == 200) {
      //       this.amt = res.data.amt;
      //       this.totalDiscountAmt = res.data.totalDiscountAmt;
      //       this.orderNo = res.data.orderNo;
      //       this.couponNo = res.data.couponNo;
      //       this.couponUserId = res.data.couponUserId;
      //       this.couponList = res.data.couponList;
      //     } else {
      //       this.amt=null
      //       this.totalDiscountAmt=null
      //       this.orderNo = null;
      //       this.couponNo =null;
      //       this.couponUserId =null;
      //       this.form.couponUserId = null;
      //       this.couponList = [];
      //       this.$message.error(res.msg);
      //     }
      //   })
      //   .catch((e) => {
      //     this.form.couponUserId = null;
      //     this.Judgment()
      //   });
    },

    // 判断现在是有没有订单号没有就创建有就更新
    Judgment() {
      const enterpriseId =
        this.presentEnterprise && this.presentEnterprise.enterpriseId;
      const stationId = this.form.stationId || this.$store.state.user.stationId;
      const data =
        this.consumerId &&
        enterpriseId &&
        stationId &&
        this.form.userId &&
        this.form.gunName &&
        this.form.receivableAmt &&
        this.form.payType;

      if (data) {
        if (this.orderNo) return this.update();
        else return this.create();
      }
    },

    handleClose(done) {
      // 实付金额
      this.amt = null;
      // 共优惠金额
      this.totalDiscountAmt = null;
      // 订单号
      this.orderNo = null;
      // 优惠券NO
      this.couponNo = null;
      // 优惠券列表
      this.couponList = [];
      // 优惠券列表id
      this.form.couponUserId = null;
      // 支付方式列表
      this.payTypeList = [];
      // 支付方式
      this.form.payType = null;
      this.couponUserIdList = []

      this.$emit("update:dialogDeduction", false);
      this.$nextTick(() => {
        this.$refs.form.resetFields();
      });
      done();
    },

    // 验证成功支付
    pay() {
      const enterpriseId =
        this.presentEnterprise && this.presentEnterprise.enterpriseId;
      const stationId = this.form.stationId || this.$store.state.user.stationId;
      const password = this.isFree ? this.form.password : true;

      const isPay =
        enterpriseId &&
        stationId &&
        this.form.userId &&
        this.form.gunName &&
        this.form.receivableAmt &&
        this.form.payType &&
        this.orderNo &&
        password &&
        this.consumerId;

      if (!isPay) return;

      const data = {
        orderNo: this.orderNo,
        couponUserId: this.form.couponUserId,
        password: this.form.password,
        consumerId: this.consumerId,
        stationId: this.form.stationId || this.$store.state.user.stationId,
        payType: this.form.payType,
      };
      pay(data).then((res) => {
        if (res.code === 200) {
          this.$message.success(res.data);
          // 实付金额
          this.amt = null;
          // 共优惠金额
          this.totalDiscountAmt = null;
          // 订单号
          this.orderNo = null;
          // 优惠券NO
          this.couponNo = null;
          // 优惠券列表
          this.couponList = [];
          // 优惠券列表id
          this.form.couponUserId = null;
          // 支付方式列表
          this.payTypeList = [];
          // 支付方式
          this.form.payType = null;

          this.$emit("update:dialogDeduction", false);
          this.$nextTick(() => {
            this.$refs.form.resetFields();
          });
        } else {
          this.$message.error(res.msg);
        }
      });
    },

    // 表单
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.pay();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    // 点击取消
    resetForm(formName) {
      // 实付金额
      this.amt = null;
      // 共优惠金额
      this.totalDiscountAmt = null;
      // 订单号
      this.orderNo = null;
      // 优惠券NO
      this.couponNo = null;
      // 优惠券列表
      this.couponList = [];
      // 优惠券列表id
      this.form.couponUserId = null;
      // 支付方式列表
      this.payTypeList = [];
      // 支付方式
      this.form.payType = null;

      this.$emit("update:dialogDeduction", false);
      this.$refs[formName].resetFields();
    },
  },
  watch: {
    dialogDeduction: {
      deep: true, // 深度监听
      handler(newVal, oldVal) {
        if (newVal) {
          // 会员id
          this.consumerId = this.couponsInfo.userId;
          // 是否开启免密
          console.log("是否开启免密", this.couponsInfo.isFree);
          // 0开启1关闭
          this.isFree = this.couponsInfo.isFree === "0" ? false : true;
          this.getUserLevel();
        }
      },
    },
    couponList: {
      deep: true, // 深度监听
      handler(newVal, oldVal) {
        if (newVal.length) {
          if (newVal.length === oldVal.length) {
            this.form.couponUserId = this.form.couponUserId;
          } else if (newVal.length > oldVal.length) {
            this.form.couponUserId = this.couponUserId;
          }
        } else {
          if (newVal.length < oldVal.length) {
            this.form.couponUserId = null;
          }
        }
      },
    },
  },
};
</script>
<style scoped lang="scss" scoped>
::v-deep .el-tag__close {
  display: none;
}
::v-deep .el-radio {
  margin: 5px 0px;
  .el-radio__input {
    .el-radio__inner {
      border-radius: 2px;
    }
  }
  .el-radio__input.is-checked .el-radio__inner::after {
    content: "";
    width: 9px;
    height: 3px;
    border: 1px solid white;
    border-top: transparent;
    border-right: transparent;
    text-align: center;
    display: block;
    position: absolute;
    top: 4px;
    left: 1px;
    vertical-align: middle;
    transform: rotate(-45deg);
    border-radius: 0px;
    background: none;
  }
}

.dialog-foot-button {
  margin-bottom: 10px;
  margin-right: 20px;
  .foot-button-left {
    width: 65px;
    height: 28px;
    background-color: #fff;
    border-top: 1px solid #747474;
    border-left: 1px solid #747474;
    border-right: 1px solid #409eff;
    border-bottom: 1px solid #747474;
    border-bottom-left-radius: 12px;
    border-top-left-radius: 12px;
  }
  .foot-button-right {
    color: #fff;
    width: 65px;
    height: 28px;
    background-color: #409eff;
    border: 1px solid #409eff;
    border-bottom-right-radius: 12px;
    border-top-right-radius: 12px;
  }
}
.dialog-foot {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.form-enableDiscount {
  display: flex;
  flex-direction: row;
}

.radio-button-span {
  margin-left: 5px;
  line-height: 28px;
  /* 超出10个字隐藏，之所以设置11em是因为省略号占一个位置 */
  width: 7em;
  overflow: hidden;
  /* 显示省略符号来代表被修剪的文本。 */
  text-overflow: ellipsis;
  /* 文本不换行 */
  white-space: nowrap;
}

::v-deep.el-radio-button {
  margin-right: 21px;
  border-radius: 0px;

  .el-radio-button__inner {
    // background-color: #ffac40;
    //修改按钮样式
    font-size: 13px;
    border-radius: 0px;
    text-align: center;
    line-height: 35px;
    padding: 0px;
    width: 100px;
    height: 28px;
    color: #000000;
    border: 1px solid rgb(104, 104, 104) !important;
  }
  .el-radio-button__orig-radio:checked + .el-radio-button__inner {
    // 修改按钮激活样式
    border-radius: 0px;
    color: #fff;
    background-color: #409eff;
    border-color: #409eff;
    border: 1px solid #409eff !important;
  }
}
::v-deep .el-dialog__body {
  padding: 0;
}
::v-deep .el-form--label-top .el-form-item__label {
  padding: 0;
  margin: 0px;
}

::v-deep .el-form-item {
  margin: 0;
  padding-bottom: 5px;
}
</style>
